<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="dubbo" />
	<meta name="description" content="dubbo" />
	<!-- 网页标签标题 -->
	<title>dubbo</title>
	<link rel="shortcut icon" href="/img/docsite.ico"/>
	<link rel="stylesheet" href="/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/en-us/index.html"><img class="logo" src="/img/txlcn.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><span class="language-switch language-switch-normal">中</span><div class="header-menu"><img class="header-menu-toggle" src="/img/system/menu_gray.png"/><ul><li class="menu-item menu-item-normal"><a href="/en-us/index.html" target="_self">Home</a></li><li class="menu-item menu-item-normal"><a href="https://bbs.txlcn.org/viewtopic.php?id=42" target="_self">News</a></li><li class="menu-item menu-item-normal"><a href="https://bbs.txlcn.org/" target="_self">Forum</a></li><li class="menu-item menu-item-normal"><a href="/en-us/docs/preface.html" target="_self">Docs</a></li><li class="menu-item menu-item-normal"><a href="https://github.com/codingapi/tx-lcn/releases" target="_blank">Download</a></li><li class="menu-item menu-item-normal"><a href="/en-us/sponsor/index.html" target="_self">Sponsor</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="/img/system/docs.png" class="front-img"/><span>Documents</span><img src="/img/system/docs.png" class="back-img"/></div></div><section class="content-section"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>User Guide</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/preface.html" target="_self">Preface</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/background.html" target="_self">Background</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/start.html" target="_self">Quick Start</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/dependencies.html" target="_self">Dependencies</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Demos<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/demo/env.html" target="_self">DTX Demo</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/demo/dubbo.html" target="_self">Dubbo of TC</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/demo/springcloud.html" target="_self">Springcloud of TC</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>In-depth TXLCN<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/principle/control.html" target="_self">Explain</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/principle/lcn.html" target="_self">LCN Transaction Mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/principle/tcc.html" target="_self">TCC Transaction Mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/principle/txc.html" target="_self">TXC Transaction Mode</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Settings<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/setting/client.html" target="_self">TC Settigns</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/setting/manager.html" target="_self">TM Settings</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/setting/distributed.html" target="_self">LoadBalance and TM Cluster</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Extensions<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/expansion/transaction.html" target="_self">Transaction Mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/expansion/message.html" target="_self">TXMSG&#x27;s Protocol</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/expansion/rpc.html" target="_self">TXMSG</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/communication.html" target="_self">Command of TXMSG</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/manageradmin.html" target="_self">TM guide</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/debug.html" target="_self">When troubles</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/test.html" target="_self">Test report</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/developer.html" target="_self">Developers</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/fqa.html" target="_self">FQA</a></li></ul></li></ul></div><div class="doc-content markdown-body"><h1>Dubbo示例</h1>
<p>Dubbo 示例说明<br>
共三个模块如下：<br>
dubbo-demo-client(发起方 | LCN模式)<br>
dubbo-demo-d  (参与方 | TXC模式)<br>
dubbo-demo-e  (参与方 | TCC模式)</p>
<p>代码地址:<a href="https://github.com/codingapi/txlcn-demo">https://github.com/codingapi/txlcn-demo</a></p>
<p>调用关系说明:</p>
<p>dubbo-demo-client -&gt; DemoConsumerController的<code>txlcn</code>的Mapping是调用发起方法，代码如下。</p>
<pre><code class="language-java"><span class="hljs-meta">@RestController</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DemoConsumerController</span> </span>{


    <span class="hljs-meta">@Autowired</span>
    <span class="hljs-keyword">private</span> DemoApiService demoApiService;


    <span class="hljs-meta">@RequestMapping</span>(<span class="hljs-string">"/txlcn"</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">sayHello</span><span class="hljs-params">(@RequestParam(<span class="hljs-string">"value"</span>)</span> String value) </span>{
        <span class="hljs-keyword">return</span> demoApiService.execute(value);
    }

}

</code></pre>
<p>DemoApiService.execute(value)方法代码:</p>
<pre><code class="language-java"><span class="hljs-meta">@Service</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DemoApiServiceImpl</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">DemoApiService</span> </span>{

    <span class="hljs-meta">@Reference</span>(version = <span class="hljs-string">"${demo.service.version}"</span>,
            application = <span class="hljs-string">"${dubbo.application.d}"</span>,
            registry = <span class="hljs-string">"${dubbo.registry.address}"</span>,
            retries = -<span class="hljs-number">1</span>,
            check = <span class="hljs-keyword">false</span>,
            loadbalance = <span class="hljs-string">"txlcn_random"</span>)
    <span class="hljs-keyword">private</span> DDemoService dDemoService;

    <span class="hljs-meta">@Reference</span>(version = <span class="hljs-string">"${demo.service.version}"</span>,
            application = <span class="hljs-string">"${dubbo.application.e}"</span>,
            retries = -<span class="hljs-number">1</span>,
            check = <span class="hljs-keyword">false</span>,
            registry = <span class="hljs-string">"${dubbo.registry.address}"</span>,
            loadbalance = <span class="hljs-string">"txlcn_random"</span>)
    <span class="hljs-keyword">private</span> EDemoService eDemoService;

    <span class="hljs-meta">@Autowired</span>
    <span class="hljs-keyword">private</span> DemoMapper demoMapper;

    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@LcnTransaction</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">execute</span><span class="hljs-params">(String name)</span> </span>{

        <span class="hljs-comment">/*
         * 注意 5.0.0 请用 DTXLocal 类
         * 注意 5.0.0 请自行获取应用名称
         * 注意 5.0.0 其它类重新导入包名
         */</span>
        String dResp = dDemoService.rpc(name);
        String eResp = eDemoService.rpc(name);
        Demo demo = <span class="hljs-keyword">new</span> Demo();
        demo.setCreateTime(<span class="hljs-keyword">new</span> Date());
        demo.setAppName(Transactions.APPLICATION_ID_WHEN_RUNNING);
        demo.setDemoField(name);
        demo.setGroupId(DTXLocalContext.getOrNew().getGroupId());
        demo.setUnitId(DTXLocalContext.getOrNew().getUnitId());
        demoMapper.save(demo);

<span class="hljs-comment">//        int a = 1 / 0;</span>
        <span class="hljs-keyword">return</span> dResp + <span class="hljs-string">" &gt; "</span> + eResp + <span class="hljs-string">" &gt; "</span> + <span class="hljs-string">"client-ok"</span>;
    }
}


</code></pre>
<p>参与方dDemoService.rpc(name)的代码</p>
<pre><code class="language-java"><span class="hljs-meta">@Service</span>(
        version = <span class="hljs-string">"${demo.service.version}"</span>,
        application = <span class="hljs-string">"${dubbo.application.id}"</span>,
        protocol = <span class="hljs-string">"${dubbo.protocol.id}"</span>,
        registry = <span class="hljs-string">"${dubbo.registry.id}"</span>
)
<span class="hljs-meta">@Slf</span>4j
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DefaultDemoService</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">DDemoService</span> </span>{

    <span class="hljs-meta">@Autowired</span>
    <span class="hljs-keyword">private</span> DDemoMapper demoMapper;

    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@TxTransaction</span>(type = <span class="hljs-string">"txc"</span>)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">rpc</span><span class="hljs-params">(String name)</span> </span>{

        <span class="hljs-comment">/*
         * 注意 5.0.0 请用 DTXLocal 类
         * 注意 5.0.0 请自行获取应用名称
         * 注意 5.0.0 其它类重新导入包名
         */</span>
        log.info(<span class="hljs-string">"GroupId: {}"</span>, TracingContext.tracing().groupId());
        Demo demo = <span class="hljs-keyword">new</span> Demo();
        demo.setDemoField(name);
        demo.setCreateTime(<span class="hljs-keyword">new</span> Date());
        demo.setGroupId(DTXLocalContext.getOrNew().getGroupId());
        demo.setAppName(Transactions.APPLICATION_ID_WHEN_RUNNING);
        demo.setUnitId(DTXLocalContext.getOrNew().getUnitId());
        demoMapper.save(demo);
        <span class="hljs-keyword">return</span> <span class="hljs-string">"d-ok"</span>;
    }

}

</code></pre>
<p>参与方eDemoService.rpc(name)的代码</p>
<pre><code class="language-java"><span class="hljs-meta">@Service</span>(
        version = <span class="hljs-string">"${demo.service.version}"</span>,
        application = <span class="hljs-string">"${dubbo.application.id}"</span>,
        protocol = <span class="hljs-string">"${dubbo.protocol.id}"</span>,
        registry = <span class="hljs-string">"${dubbo.registry.id}"</span>
)
<span class="hljs-meta">@Slf</span>4j
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DefaultDemoService</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">EDemoService</span> </span>{

    <span class="hljs-meta">@Autowired</span>
    <span class="hljs-keyword">private</span> EDemoMapper demoMapper;

    <span class="hljs-keyword">private</span> ConcurrentHashMap&lt;String, Long&gt; ids = <span class="hljs-keyword">new</span> ConcurrentHashMap&lt;&gt;();

    <span class="hljs-meta">@Override</span>
    <span class="hljs-meta">@TccTransaction</span>(confirmMethod = <span class="hljs-string">"cm"</span>, cancelMethod = <span class="hljs-string">"cl"</span>, executeClass = DefaultDemoService.class)
    <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">rpc</span><span class="hljs-params">(String name)</span> </span>{
        <span class="hljs-comment">/*
         * 注意 5.0.0 请用 DTXLocal 类
         * 注意 5.0.0 请自行获取应用名称
         * 注意 5.0.0 其它类重新导入包名
         */</span>
        log.info(<span class="hljs-string">"GroupId: {}"</span>, TracingContext.tracing().groupId());
        Demo demo = <span class="hljs-keyword">new</span> Demo();
        demo.setDemoField(name);
        demo.setCreateTime(<span class="hljs-keyword">new</span> Date());
        demo.setGroupId(DTXLocalContext.getOrNew().getGroupId());
        demo.setUnitId(DTXLocalContext.getOrNew().getUnitId());
        demo.setAppName(Transactions.APPLICATION_ID_WHEN_RUNNING);
        demoMapper.save(demo);
        ids.put(DTXLocalContext.cur().getGroupId(), demo.getId());
        <span class="hljs-keyword">return</span> <span class="hljs-string">"e-ok"</span>;
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">cm</span><span class="hljs-params">(String name)</span> </span>{
        log.info(<span class="hljs-string">"tcc-confirm-"</span> + DTXLocalContext.getOrNew().getGroupId());
        ids.remove(DTXLocalContext.getOrNew().getGroupId());
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">cl</span><span class="hljs-params">(String name)</span> </span>{
        log.info(<span class="hljs-string">"tcc-cancel-"</span> + DTXLocalContext.getOrNew().getGroupId());
        demoMapper.deleteByKId(ids.get(DTXLocalContext.getOrNew().getGroupId()));
    }
}

</code></pre>
<h2>事务参与方D配置</h2>
<p>工程截图<br>
<img src="../../../img/docs/maven-d.png" alt="maven project"><br>
项目配置文件 application.properties</p>
<pre><code class="language-properties"><span class="hljs-comment"># Spring boot application</span>
<span class="hljs-meta">spring.application.name</span>=<span class="hljs-string">dubbo-demo-d</span>
<span class="hljs-meta">server.port</span>=<span class="hljs-string">12005</span>
<span class="hljs-meta">management.port</span>=<span class="hljs-string">12008</span>
<span class="hljs-comment">
# Service version</span>
<span class="hljs-meta">demo.service.version</span>=<span class="hljs-string">1.0.0</span>
<span class="hljs-comment">
# Base packages to scan Dubbo Components (e.g @Service , @Reference)</span>
<span class="hljs-meta">dubbo.scan.basePackages</span>=<span class="hljs-string">com.example</span>
<span class="hljs-comment">
# Dubbo Config properties</span>
<span class="hljs-comment">## ApplicationConfig Bean</span>
<span class="hljs-meta">dubbo.application.id</span>=<span class="hljs-string">dubbo-demo-d</span>
<span class="hljs-meta">dubbo.application.name</span>=<span class="hljs-string">dubbo-demo-d</span>
<span class="hljs-comment">
## ProtocolConfig Bean</span>
<span class="hljs-meta">dubbo.protocol.id</span>=<span class="hljs-string">dubbo</span>
<span class="hljs-meta">dubbo.protocol.name</span>=<span class="hljs-string">dubbo</span>
<span class="hljs-meta">dubbo.protocol.port</span>=<span class="hljs-string">12345</span>
<span class="hljs-comment">
## RegistryConfig Bean</span>
<span class="hljs-meta">dubbo.registry.id</span>=<span class="hljs-string">my-registry</span>
<span class="hljs-meta">dubbo.registry.address</span>=<span class="hljs-string">127.0.0.1:2181</span>
<span class="hljs-meta">dubbo.registry.protocol</span>=<span class="hljs-string">zookeeper</span>
<span class="hljs-meta">dubbo.application.qos.enable</span>=<span class="hljs-string">false</span>
<span class="hljs-comment">
## DB</span>
<span class="hljs-meta">spring.datasource.driver-class-name</span>=<span class="hljs-string">com.mysql.jdbc.Driver</span>
<span class="hljs-meta">spring.datasource.url</span>=<span class="hljs-string">jdbc:mysql://127.0.0.1:3306/txlcn-demo?characterEncoding=UTF-8&amp;serverTimezone=UTC</span>
<span class="hljs-meta">spring.datasource.username</span>=<span class="hljs-string">root</span>
<span class="hljs-meta">spring.datasource.password</span>=<span class="hljs-string">root</span>
<span class="hljs-meta">spring.datasource.hikari.maximum-pool-size</span>=<span class="hljs-string">20</span>
<span class="hljs-meta">mybatis.configuration.map-underscore-to-camel-case</span>=<span class="hljs-string">true</span>
<span class="hljs-meta">mybatis.configuration.use-generated-keys</span>=<span class="hljs-string">true</span>
<span class="hljs-comment">
## tx-manager 配置</span>
<span class="hljs-comment">#tx-lcn.client.manager-address=127.0.0.1:8070</span>
</code></pre>
<h2>Application代码</h2>
<pre><code class="language-java">
<span class="hljs-meta">@SpringBootApplication</span>
<span class="hljs-meta">@EnableDistributedTransaction</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DemoDubboDApplication</span> </span>{

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        SpringApplication.run(DemoDubboDApplication.class, args);

    }

}

</code></pre>
<h2>事务参与方 E</h2>
<p>工程截图<br>
<img src="../../../img/docs/maven-e.png" alt="maven project"><br>
配置文件 application.properties</p>
<pre><code class="language-properties"><span class="hljs-comment">
# Spring boot application</span>
<span class="hljs-meta">spring.application.name</span>=<span class="hljs-string">dubbo-demo-e</span>
<span class="hljs-meta">server.port</span>=<span class="hljs-string">12006</span>
<span class="hljs-meta">management.port</span>=<span class="hljs-string">12009</span>
<span class="hljs-comment">
# Service version</span>
<span class="hljs-meta">demo.service.version</span>=<span class="hljs-string">1.0.0</span>
<span class="hljs-comment">
# Base packages to scan Dubbo Components (e.g @Service , @Reference)</span>
<span class="hljs-meta">dubbo.scan.basePackages</span>=<span class="hljs-string">com.example</span>
<span class="hljs-comment">
# Dubbo Config properties</span>
<span class="hljs-comment">## ApplicationConfig Bean</span>
<span class="hljs-meta">dubbo.application.id</span>=<span class="hljs-string">dubbo-demo-e</span>
<span class="hljs-meta">dubbo.application.name</span>=<span class="hljs-string">dubbo-demo-e</span>

<span class="hljs-meta">dubbo.application.service4</span>=<span class="hljs-string">dubbo-demo-client</span>
<span class="hljs-comment">
## ProtocolConfig Bean</span>
<span class="hljs-meta">dubbo.protocol.id</span>=<span class="hljs-string">dubbo</span>
<span class="hljs-meta">dubbo.protocol.name</span>=<span class="hljs-string">dubbo</span>
<span class="hljs-meta">dubbo.protocol.port</span>=<span class="hljs-string">12346</span>
<span class="hljs-comment">
## RegistryConfig Bean</span>
<span class="hljs-meta">dubbo.registry.id</span>=<span class="hljs-string">my-registry</span>
<span class="hljs-meta">dubbo.registry.address</span>=<span class="hljs-string">127.0.0.1:2181</span>
<span class="hljs-meta">dubbo.registry.protocol</span>=<span class="hljs-string">zookeeper</span>

<span class="hljs-meta">dubbo.application.qos.enable</span>=<span class="hljs-string">false</span>
<span class="hljs-comment">
#db</span>
<span class="hljs-meta">spring.datasource.driver-class-name</span>=<span class="hljs-string">com.mysql.jdbc.Driver</span>
<span class="hljs-meta">spring.datasource.url</span>=<span class="hljs-string">jdbc:mysql://127.0.0.1:3306/txlcn-demo\
  ?characterEncoding=UTF-8&amp;serverTimezone=UTC</span>
<span class="hljs-meta">spring.datasource.username</span>=<span class="hljs-string">root</span>
<span class="hljs-meta">spring.datasource.password</span>=<span class="hljs-string">root</span>
<span class="hljs-meta">spring.datasource.hikari.maximum-pool-size</span>=<span class="hljs-string">20</span>

<span class="hljs-meta">mybatis.configuration.map-underscore-to-camel-case</span>=<span class="hljs-string">true</span>
<span class="hljs-meta">mybatis.configuration.use-generated-keys</span>=<span class="hljs-string">true</span>
<span class="hljs-comment">
## tx-manager 配置</span>
<span class="hljs-comment">#tx-lcn.client.manager-address=127.0.0.1:8070</span>

</code></pre>
<h2>Application代码</h2>
<pre><code class="language-java"><span class="hljs-meta">@SpringBootApplication</span>
<span class="hljs-meta">@EnableDistributedTransaction</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DemoDubboEApplication</span> </span>{

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        SpringApplication.run(DemoDubboEApplication.class, args);

    }

}

</code></pre>
<h2>事务发起方 Client</h2>
<p>工程目录<br>
<img src="../../../img/docs/maven.png" alt="maven project"><br>
项目配置文件 application.properties</p>
<pre><code class="language-properties"><span class="hljs-comment">
# Spring boot application</span>
<span class="hljs-meta">spring.application.name</span>=<span class="hljs-string">dubbo-demo-client</span>
<span class="hljs-meta">server.port</span>=<span class="hljs-string">12004</span>
<span class="hljs-meta">management.port</span>=<span class="hljs-string">12007</span>
<span class="hljs-comment">
# Service Version</span>
<span class="hljs-meta">demo.service.version</span>=<span class="hljs-string">1.0.0</span>
<span class="hljs-comment">
# Dubbo Config properties</span>
<span class="hljs-comment">## ApplicationConfig Bean</span>
<span class="hljs-meta">dubbo.application.id</span>=<span class="hljs-string">dubbo-demo-client</span>
<span class="hljs-meta">dubbo.application.name</span>=<span class="hljs-string">dubbo-demo-client</span>
<span class="hljs-meta">dubbo.application.d</span>=<span class="hljs-string">dubbo-demo-d</span>
<span class="hljs-meta">dubbo.application.e</span>=<span class="hljs-string">dubbo-demo-e</span>
<span class="hljs-comment">## ProtocolConfig Bean</span>
<span class="hljs-meta">dubbo.protocol.id</span>=<span class="hljs-string">dubbo</span>
<span class="hljs-meta">dubbo.protocol.name</span>=<span class="hljs-string">dubbo</span>
<span class="hljs-meta">dubbo.protocol.port</span>=<span class="hljs-string">12345</span>
<span class="hljs-meta">dubbo.registry.protocol</span>=<span class="hljs-string">zookeeper</span>
<span class="hljs-meta">dubbo.registry.address</span>=<span class="hljs-string">127.0.0.1:2181</span>


<span class="hljs-meta">spring.datasource.driver-class-name</span>=<span class="hljs-string">com.mysql.jdbc.Driver</span>
<span class="hljs-meta">spring.datasource.url</span>=<span class="hljs-string">jdbc:mysql://127.0.0.1:3306/txlcn-demo?characterEncoding=UTF-8&amp;serverTimezone=UTC</span>
<span class="hljs-meta">spring.datasource.username</span>=<span class="hljs-string">root</span>
<span class="hljs-meta">spring.datasource.password</span>=<span class="hljs-string">root</span>
<span class="hljs-meta">spring.datasource.hikari.maximum-pool-size</span>=<span class="hljs-string">20</span>
<span class="hljs-meta">mybatis.configuration.map-underscore-to-camel-case</span>=<span class="hljs-string">true</span>
<span class="hljs-meta">mybatis.configuration.use-generated-keys</span>=<span class="hljs-string">true</span>
<span class="hljs-comment">
## 切面日志信息(h2数据库地址,自创建)</span>
<span class="hljs-comment">#tx-lcn.aspect.log.file-path=D://txlcn/h2-${spring.application.name}</span>
<span class="hljs-comment">#</span>
<span class="hljs-comment">## manager服务地址(rpc端口),可填写多个负载</span>
<span class="hljs-comment">#tx-lcn.client.manager-address=127.0.0.1:8070</span>
<span class="hljs-comment">#</span>
<span class="hljs-comment">## 开启日志数据库记录存储</span>
<span class="hljs-comment">#tx-lcn.logger.enabled=true</span>
<span class="hljs-comment">## 日志数据库存储jdbc配置</span>
<span class="hljs-comment">#tx-lcn.logger.driver-class-name=com.mysql.jdbc.Driver</span>
<span class="hljs-comment">#tx-lcn.logger.jdbc-url=jdbc:mysql://127.0.0.1:3306/tx-logger?characterEncoding=UTF-8&amp;serverTimezone=UTC</span>
<span class="hljs-comment">#tx-lcn.logger.username=root</span>
<span class="hljs-comment">#tx-lcn.logger.password=123456</span>

</code></pre>
<h2>启动Dubbo微服务</h2>
<p>事务参与方 D<br>
<img src="../../../img/docs/dubbo-d.png" alt="dubbo-d">
事务参与方 E<br>
<img src="../../../img/docs/dubbo-e.png" alt="dubbo-e">
事务发起方 Client<br>
<img src="../../../img/docs/dubbo-client.png" alt="dubbo-client"></p>
</div></section><footer class="footer-container"><div class="footer-body"><img src="/img/txlcn.png"/><div class="cols-container"><div class="col col-12"><h3>Vision</h3><p>We will devote ourselves to creating a fast, efficient and concurrent distributed transaction solution.</p></div><div class="col col-6"><dl><dt>Navigation</dt><dd><a href="/zh-cn/docs/txlcn-arch.html" target="_self">TX-LCN Solution</a></dd><dd><a href="/zh-cn/docs/start.html" target="_self">Get Started</a></dd><dd><a href="/zh-cn/docs/txlcn-mod.html" target="_self">Develop Plan</a></dd><dd><a href="https://bbs.txlcn.org/viewforum.php?id=8" target="_self">Report Bug</a></dd></dl></div><div class="col col-6"><dl><dt>Friendship Link</dt><dd><a href="https://www.codingapi.com/" target="_blank">CodingApi</a></dd></dl></div></div><div class="copyright"><span>Copyright © 2018 CodingApi</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '';
  </script>
	<script src="/build/documentation.js"></script>
</body>
</html>